package org.raftkv.raft.core.readonly;


import org.raftkv.raft.pb.Message;

import java.util.Map;

public class ReadIndexStatus {

    /**
     * 保存原始的 readIndex 请求消息
     */
    private Message req;

    /**
     * 保存收到该 readIndex 请求时的 leader commit 索引
     */
    private long index;

    /**
     * 保存有什么节点进行了应答，从这里可以计算出来是否有超过半数应答了
     */
    private Map<Long, Boolean> acks;

    public ReadIndexStatus(long index, Message req, Map<Long, Boolean> acks) {
        this.req = req;
        this.index = index;
        this.acks = acks;
    }

    public void setIndex(long index) {
        this.index = index;
    }

    public void setAcks(Map<Long, Boolean> acks) {
        this.acks = acks;
    }

    public Message getReq() {
        return req;
    }

    public void setReq(Message req) {
        this.req = req;
    }

    public long getIndex() {
        return index;
    }

    public Map<Long, Boolean> getAcks() {
        return acks;
    }

}
